import {INCREMENTCOUNT,DECREMENTCOUNT} from '../constant/countconst'
import store from '../store'
export const incrementCount = (data=1)=>{
  return ({
    type:INCREMENTCOUNT,
    data
  })
}
export const decrementCount = (data=1)=>{
  return ({
    type:DECREMENTCOUNT,
    data
  })
}

//异步请求处理
export const waitIncrementCount = (data = 1)=>{
  return ()=>{
    setTimeout(()=>{
      //返回一个函数,函数中处理异步然后发送数据
      store.dispatch({
        type:INCREMENTCOUNT,
        data
      })
    },2000)
  }
}

